<%- include('../../common/header.html',{css:'no-common'}) %>

<style>
        .dl-horizontal dt {
            width: 350px;
        }
    </style>
    <title>客户管理-后台管理系统</title>
</head>

<body class="sub-body">
<%- include('../../common/nav.html') %>
<section class="content-header">
    <h1>订单结算</h1>
    <ol class="breadcrumb">
        <li>
            <a href="../index.html"><i class="fa fa-home"></i> 首页</a>
        </li>
        <li>
            <a href="./index.html">结算中心</a>
        </li>
        <li class="active">订单结算</li>
    </ol>
</section>

<div class="content">
    <div class="panel panel-default">
        <div class="panel-body">

            <dl class="dl-horizontal">
                <dt>订单编号：</dt>
                <dd class="no"></dd>
                <dt>货物名称：</dt>
                <dd class="goodsName"></dd>
                <dt>单价：</dt>
                <dd class="actualPrice"></dd>
                <dt>数量：</dt>
                <dd class="number"></dd>
                <dt>总金额：</dt>
                <dd class="total"></dd>
                <dt>交货数量：</dt>
                <dd class="deliverNumber"></dd>
                <dt>付款状态：</dt>
                <dd class="payStatus"></dd>
                <dt>发货状态：</dt>
                <dd class="deliverStatus"></dd>
                <dt>审核状态：</dt>
                <dd class="checkStatus"></dd>
                <dt>订单状态：</dt>
                <dd class="status"></dd>
                <dt>客户名称：</dt>
                <dd class="clienteleName"></dd>
                <dt>客户联系人：</dt>
                <dd class="clienteleUserName"></dd>
                <dt>联系人手机：</dt>
                <dd class="clienteleUserPhone"></dd>
                <dt>提货方式：</dt>
                <dd class="pickUpMethod"></dd>
                <dt>免费仓储期：</dt>
                <dd class="freeStoreType"></dd>
                <dt>交货日期：</dt>
                <dd class="deliveryType"></dd>
                <dt>付款方式：</dt>
                <dd class="payMethod"></dd>
                <dt>付款日期：</dt>
                <dd class="payDate"></dd>
                <dt>付款条件：</dt>
                <dd class="payCondition"></dd>
                <dt>创建时间：</dt>
                <dd class="createAt"></dd>
            </dl>
        </div>
    </div>
</div>
</body>
<%- include('../../common/script-moment.html') %>
<%- include('../../common/script-common.html') %>

<script type="text/javascript">
    $(function () {
        var searchObj = parseSearch();
        if (searchObj.id == 0 || searchObj.id) {
            $.get('/order/get?id=' + searchObj.id, function (data) {
                if (data.code == 200) {
                    var clientele = data.data;
                    var fields = 'no|goodsName|actualPrice|number|total|deliverNumber|payStatus|deliverStatus|checkStatus|status|' +
                            'clienteleName|clienteleUserName|clienteleUserPhone|pickUpMethod' +
                            '|freeStoreType|deliveryType|payMethod|payDate|payCondition|createAt';
                    fields.split('|').map(function (key) {

                        if (key == 'createAt') {
                            $('.' + key).html(moment(clientele[key]).format('YYYY-MM-DD HH:mm:ss'));
                        } else if (key == 'payStatus') {
                            $('.' + key).html((clientele[key] == 0 ? '未付款' : (clientele[key] == 1 ? '已付款' : '')));
                        } else if (key == 'deliverStatus') {
                            $('.' + key).html((clientele[key] == 0 ? '未发货' : (clientele[key] == 1 ? '已全部发货' : (clientele[key] == 2 ? '部分发货' : ''))));
                        } else if (key == 'status') {
                            $('.' + key).html((clientele[key] == 0 ? '正常' : (clientele[key] == 1 ? '终止执行' : (clientele[key] == 2 ? '强制执行完毕' : ''))));
                        } else if (key == 'checkStatus') {
                            $('.' + key).html((clientele[key] == 0 ? '未审核' : (clientele[key] == 1 ? '通过' : (clientele[key] == 2 ? '拒绝' : ''))));
                        } else if (key == 'pickUpMethod') {
                            $('.' + key).html((clientele[key] == 0 ? '自提' : (clientele[key] == 1 ? '免费配送' : '')));
                        } else if (key == 'freeStoreType') {
                            $('.' + key).html((clientele[key] == 0 ? '合同签订日起' : (clientele[key] == 1 ? '交割日起' : '')) + clientele['freeStoreDay'] + '天');
                        } else if (key == 'deliveryType') {
                            $('.' + key).html(moment(clientele['deliveryDay']).format('YYYY-MM-DD HH:mm:ss') + (clientele[key] == 0 ? '' : (clientele[key] == 1 ? '至' + moment(clientele['deliveryDayEnd']).format('YYYY-MM-DD HH:mm:ss') : '')));
                        } else if (key == 'payMethod') {
                            $('.' + key).html((clientele[key] == 0 ? '银行电汇' : (clientele[key] == 1 ? '承兑汇票' : '国内信用证')));
                        } else if (key == 'createAt'||key == 'payDate') {
                            $('.' + key).html(moment(clientele[key]).format('YYYY-MM-DD HH:mm:ss'));
                        } else {
                            $('.' + key).html(clientele[key]);
                        }
                    })
                } else {
                    alert(data.error);
                }
            })
        }
    })
</script>

</html>